package com.sunfeng.n4.deadlock;

import com.sunfeng.TimeUtils;
import lombok.extern.slf4j.Slf4j;

@Slf4j(topic = "c.Test32")
public class Test32 {
    // 易变
    static boolean run = true;

    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
            while (run) {
                //   println 是带锁的
                System.out.println("a");
            }
        });
        t.start();

        TimeUtils.sleep(1);
        run = false; // 线程t不会如预想的停下来
    }
}
